package com.szt.sy.util.tld;

import com.szt.sy.common.AuthorityCommon;
import com.szt.sy.config.SecurityConfig;
import com.szt.sy.util.spring.HttpContextUtils;

/***
 * tld-日期工具
 * 
 * @author wwy shiqiyue.github.com
 *
 */
public class SecurityUtils {
	
	public static Boolean hasAuthority(String authName) {
		String prefix = (String) HttpContextUtils.getHttpServletRequest()
				.getAttribute(SecurityConfig.AUTHORITY_PREFIX_ATTRIBUTE_NAME);
		return com.szt.sy.util.security.SecurityUtils.hasAuthority(prefix, authName);
	}
	
	public static Boolean listAble() {
		return hasAuthority(AuthorityCommon.LIST);
	}
	
	public static Boolean addAble() {
		return hasAuthority(AuthorityCommon.ADD);
	}
	
	public static Boolean editAble() {
		return hasAuthority(AuthorityCommon.EDIT);
	}
	
	public static Boolean deleteAble() {
		return hasAuthority(AuthorityCommon.DELETE);
	}
	
	public static Boolean exportExcelAble() {
		return hasAuthority(AuthorityCommon.EXPORT_EXCEL);
	}
	
}
